package com.syni.mdd.sjb.common.datatreaure.entity.bo.userChannel;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class MinAppServiceBo {
    public static final int SERVICE_TYPE_0 = 0;
    public static final String SERVICE_TYPE_0_MSG = "通用";
    public static final int SERVICE_TYPE_1 = 1;
    public static final String SERVICE_TYPE_1_MSG = "小程序";
    public static final int SERVICE_TYPE_2 = 2;
    public static final String SERVICE_TYPE_2_MSG = "小商店";
    private Integer recordType;
    private String title;
    private BigDecimal price;
    private BigDecimal payAmount;
    private String recordCreateTime;
    private Integer count;
    private Integer indate;
    private Integer serviceType;
    private String typeName = "";

//    public void setRecordCreateTime(String recordCreateTime) {
//        String[] recordCreateTimes = recordCreateTime.split("T");
//        this.recordCreateTime = recordCreateTimes[0] + " " + recordCreateTimes[1];
//    }

    public void setServiceType(Integer serviceType) {
        this.serviceType = serviceType;
        if(serviceType == SERVICE_TYPE_0){
            this.typeName = SERVICE_TYPE_0_MSG;
        }else if(serviceType == SERVICE_TYPE_1){
            this.typeName = SERVICE_TYPE_1_MSG;
        }else if(serviceType == SERVICE_TYPE_2){
            this.typeName = SERVICE_TYPE_2_MSG;
        }
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this, SerializerFeature.WriteMapNullValue);
    }
}
